package com.trkj.controller.lzs;


import java.sql.Timestamp;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


import com.trkj.pojo.StaffInformation;
import com.trkj.service.lzs.Emp_payService;
import com.trkj.vo.Result;
import com.trkj.vo.emp_payVO;


@Controller
public class Emp_payController {
	@Autowired
	private Emp_payService emp_payService;
	
/*	//员工本薪数据
	@RequestMapping("to_emp_pay")
	public String to_emp_pay(){
		return "lq/emp_pay";
	}
	//员工本薪数据
	@RequestMapping("to_emp_pay_add")
	public String to_emp_pay_add(){
		return "lq/emp_pay_add";
	}
	*/
	/**
	 * 查
	 * @return
	 */
	@RequestMapping("selcet_emp_pay")
	@ResponseBody
	public List<emp_payVO> selcet_emp_pay(){
		try {
			return emp_payService.selcet_emp_pay();
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}
	/**
	 * 模糊查
	 * @return
	 */
	@RequestMapping("emp_pay_search")
	@ResponseBody
	public List<emp_payVO> td_forid(String text) {
		if(text==null||text=="") {
			return emp_payService.selcet_emp_pay();
		}else{
			return (List<emp_payVO>) emp_payService.select_find_idname(text);
		}
	}
	/**
	 * 查
	 * @return
	 */
	@RequestMapping("selcet_StaffInformation")
	@ResponseBody
	public List<StaffInformation> selcet_StaffInformation(){
		try {
			emp_payService.selcet_StaffInformation().forEach(e->{
				System.err.println("aaaaaaaaaa"+e);
			});
			return emp_payService.selcet_StaffInformation();
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}
	/**
	 * 增
	 * @param s
	 * @return
	 */
	@PostMapping("emp_pay_add")
	@ResponseBody
	public Result add_emp_pay(StaffInformation staff,Long accountId){
		try {
			emp_payService.insert_emp_pay(staff, accountId);
			return Result.SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return Result.failure(e.getMessage());
		}
	}
}
